#!/bin/sh

file1="./test-files/out.1"
file2="/tmp/out.tmp"

echo "Realizando prueba: \"./tp0 -r 8x8 -o -\""
./tp0 -r 8x8 -o - > "$file2"

echo
cat "$file2"
echo
if diff -a -q "$file1" "$file2"
then
	echo "Prueba exitosa."
else
	echo "Prueba fallida."
fi
echo
echo
rm -f "$file2" >/dev/null

file1="./test-files/out.2"
file2="/tmp/out.tmp"

echo "Realizando prueba: \"./tp0 -r 16x8 -o -\""
./tp0 -r 16x8 -o - > "$file2"

echo
cat "$file2"
echo
if diff -a -q "$file1" "$file2"
then
	echo "Prueba exitosa."
else
	echo "Prueba fallida."
fi
echo
echo
rm -f "$file2" >/dev/null

file1="./test-files/out.3"
file2="/tmp/test"

echo "Realizando prueba: \"./tp0 -r 16x16 -o /tmp/test\""
./tp0 -r 16x16 -o "$file2"

echo
cat "$file2"
echo
if diff -a -q "$file1" "$file2"
then
	echo "Prueba exitosa."
else
	echo "Prueba fallida."
fi
echo
echo
rm -f "$file2" >/dev/null

file1="./test-files/out.4"
file2="/tmp/out.tmp"

echo "Realizando prueba: \"./tp0 -d\""
./tp0 -d >/dev/null 2> "$file2"

echo
cat "$file2"
echo
if diff -a -q "$file1" "$file2"
then
	echo "Prueba exitosa."
else
	echo "Prueba fallida."
fi
echo
echo
rm -f "$file2" >/dev/null

file1="./test-files/out.5"
file2="/tmp/out.tmp"

echo "Realizando prueba: \"tp0 -h\""
./tp0 -h >/dev/null 2> "$file2"

echo
cat "$file2"
echo
if diff -a -q "$file1" "$file2"
then
	echo "Prueba exitosa."
else
	echo "Prueba fallida."
fi
echo
echo
rm -f "$file2" >/dev/null

file1="./test-files/out.6"
file2="/tmp/out.tmp"

echo "Realizando prueba: \"tp0 --help\""
./tp0 --help >/dev/null 2> "$file2"

echo
cat "$file2"
echo
if diff -a -q "$file1" "$file2"
then
	echo "Prueba exitosa."
else
	echo "Prueba fallida."
fi
echo
echo
rm -f "$file2" >/dev/null

file1="./test-files/out.7"
file2="/tmp/out.tmp"

echo "Realizando prueba: \"tp0 -V\""
./tp0 -V >/dev/null 2> "$file2"

echo
cat "$file2"
echo
if diff -a -q "$file1" "$file2"
then
	echo "Prueba exitosa."
else
	echo "Prueba fallida."
fi
echo
echo
rm -f "$file2" >/dev/null

file1="./test-files/out.8"
file2="/tmp/out.tmp"

echo "Realizando prueba: \"tp0 --version\""
./tp0 --version >/dev/null 2> "$file2"

echo
cat "$file2"
echo
if diff -a -q "$file1" "$file2"
then
	echo "Prueba exitosa."
else
	echo "Prueba fallida."
fi
echo
echo
rm -f "$file2" >/dev/null


